#ifndef MESHIMPORTEXPORT_HPP
#define MESHIMPORTEXPORT_HPP

#include "meshTypes_fwd.hpp"


namespace hms
{


Array3Xi edgesAtBoundaryVertices(
	const Array2Xi& edgeVertices,
	Index nInnerEdges
);

Array3Xi edgesAtBoundaryVertices( const Mesh& mesh );

template<typename MeshType>
ArrayXi verticesToBoundarySegment(
	const MeshBase<MeshType>& mesh,
	const Array3i& firstSecondLast,
	const Array3Xi& edgesAtVertex = {}
);

ArrayXi verticesToBoundarySegment(
	const Array2Xi& edgeVertices,
	const Array3Xi& edgesAtVertex,
	Index firstVertex,
	Index secondVertex,
	Index lastVertex
);

ArrayXi verticesToBoundarySegment(
	const Array2Xi& edgeVertices,
	const Array3Xi& edgesAtVertex,
	const Array3i& firstSecondLast
);

ArrayXi verticesToBoundarySegment(
	const Array3i& verts,
	const Ref<const Array2i>& meshSize
);


template<typename MeshType>
Array3i boundarySegmentToVertices(
	const MeshBase<MeshType>& mesh,
	const ArrayXi& boundarySegment
);


ArrayXi boundarySegment(
	BoundaryLocation loc,
	Index firstVertex,
	Index lastVertex,
	const Ref<const Array2i>& meshSize
);

ArrayXi boundarySegmentReverse(
	BoundaryLocation loc,
	Index firstVertex,
	Index lastVertex,
	const Ref<const Array2i>& meshSize
);

std::vector<ArrayXi> verticesToStructPatches(
	Array3i vertices,
	const Ref<const Array2i>& meshSize
);

template<typename MeshType>
void addBoundaryPatch(
	MeshBase<MeshType>& mesh,
	const std::string& patchName,
	const Array3i& vertices,
	const Array3Xi& edgesAtVertex = {}
);


} // end namespace hms


#endif